/**
 * @Author:周邱艳
 * @Date:2020/6/30
 * @Description:这是持仓详细页的累计收益
 */
import React,{Component} from "react";
import {Card} from "antd";
import ReactEcharts from "echarts-for-react";
import axios from "axios";
import {List} from "antd-mobile";
import {getCookieId} from "../../Login/Component_Login/GetCookie";
const Item = List.Item;
const Brief = Item.Brief;
export default class ProductTotalMoney extends Component{
    constructor(props) {
        super(props);
        this.state={
            positionDetailItems:[]//json总表
        }
        this.loadData = this.loadData.bind(this)
    }
    loadData(){
        axios({
            method:"GET",
            url:"http://39.101.141.248:9527/wealthPosition/showPositionDetailItems",
            params:{accountId:this.props.fatheraccountId}//this.props.userId,this.props.tradeId
        }).then(res=>{
            this.setState({
                positionDetailItems:res.data.positionDetailItems,
            })
        }).catch(error =>{
            console.log(error)
        })
    }
    componentDidMount() {
        this.loadData()
    }
    //数据渲染
    render() {
        return(
                        <div>
                            <List className="my-list">
                                <Item extra={<p style={{fontSize:"1.8rem",color:"black"}}>昨日收益金额</p>}
                                      style={{fontSize:"2.5rem",color:"black"}}>产品名称</Item>
                            </List>
                            {(()=>{return this.state.positionDetailItems.map((item,index)=>{
                                return(
                                    <List className="my-list">
                                        <Item extra={<p style={{fontSize:"1.8rem",color:"red"}}>{item.totalMoney}</p>}
                                              style={{fontSize:"2.5rem",color:"black"}}>{item.comName}</Item>
                                    </List>
                                )
                            })})()}
                        </div>
        )
    }
}

